1. Technical Field
The present invention relates to a method for controlling write cache transfer for sequentially transferring a unit of data from outside of a storage device to a write cache buffer provided in the storage device, which is, for example, a disk unit provided with a write cache function (a cache used for storing transferred data requested to be written on a recording medium), as well as a disk unit provided with a write cache function, realized by employing this controlling method.
2. Description of the Related Art
Data to be written on a medium (recording medium) in a storage device is usually transferred from a host system with use of a transfer procedure to be described below. At first, the host system transmits a write command to the storage device, then a start logical address of an area on the medium to be written with data, and then a data length (a unit of data) to be transferred according to the write command. After this, the host system transfers the unit of data sequentially in response to each data transfer request from the storage device. The storage device, after receiving the write command, requests that the host system transfer the unit of data. Each time the storage device receives the unit of data, it requests the next transfer of data sequentially. When receiving the whole data to be transferred with one write command, the storage device notifies the host system of the completion of the write command. A unit of data transferred with one write command, for example, to a hard disk drive (HDD), is one sector in minimum (1 sector: 512 bytes) and 256 sectors in maximum. The unit of data described above is, for example, one sector. The host system cannot transfer the next data until receiving the next data transfer request from the storage device. On the other hand, the host system cannot transmit the next write command until being notified of completion of the last write command. To transfer a series of data over the above unit, the host system repeats a sequence consisting of a data transfer request and a unit of data transfer, thereby transferring a series of unit data sequentially after transmitting a write command. And, to transfer a series of data over the maximum unit of data to be transferred with one write command, the host system repeats a sequence consisting of transmission of a write command, data transfer, and notification of completion of the write command, thereby transferring a series of unit data sequentially.
Some of the storage devices including the hard disk drive (HDD) are provided with a cache buffer respectively. And, it is now common that such a storage device provided with a cache buffer is also provided with not only a read cache function but also a write cache function.
A write cache is used to cache data transferred from a host system in the buffer before the data is written on a medium. In this specification, data transfer between a host system and a buffer with use of a write cache is referred to as xe2x80x9cwrite cache transferxe2x80x9d. On the other hand, a read cache is used to cache data read from a medium in the buffer before the data is transferred to the host system.
A storage device, if it is not provided with a cache buffer, writes transferred data on a medium, then requests that the host system transfer the next data. In a write cache transfer operation, the storage device requests that the host system transfer the next data just after completing caching of transferred data in the buffer; it does not await completion of the writing of cached data on the medium.
It takes much time to write data on a medium. In the case of a hard disk drive (HDD), data must be written in an object sector on the surface of a disk therein by seeking an object track, positioning the head on the track, then awaiting a rotational latency until the head passes over the target sector. Because the hard disk unit can request the host system for transfer of the next data before completing the writing of data on the medium with use of a write cache, it is possible to reduce the time required until the storage device requests the host system for the next transfer of a unit of data after receiving the unit of data from the host system, thereby the data transfer rate can be increased more between the host system and the storage device.
Because of a recent trend that storage devices including the HDD are getting larger and larger in capacity and faster and faster in operation speed, it is accordingly required that those storage devices are used to store such data as dynamic picture images, etc. handled by AV (Audio/Visual) application programs. A series of data handled in an AV application program is often larger than the data capacity of a cache buffer. And, to transfer a series of mass data larger than the data capacity of such a buffer sequentially with use of a write cache, the data transfer rate used between the host system and the buffer is faster than the data transfer rate (write speed) between the buffer and the disk. Therefore, the buffer often becomes full with write cached data during the write cache transfer.
To transfer a series of such data sequentially with use of a write cache, therefore, the storage device requests the host system for transferring the next data immediately after completing receiving of a unit of data until the buffer becomes full. After this, however, if the buffer becomes full, the storage device requests the next transfer of a unit of data after the buffer secures a space enough to cache the transferred data due to the writing on a medium.
In the case of the conventional write cache transfer operation, data is transferred at a high data transfer rate conforming to the transfer rate between the host system and the buffer until the buffer becomes full. After the buffer becomes full, however, the data transfer rate is lowered conforming to the data transfer rate for writing data on a medium (the data transfer rate between the buffer and the medium).
In the case of the conventional write cache transfer, if a write error occurs while the buffer is full with data, the buffer cannot make an empty space until the error is recovered. In addition, the host system is not notified of the completion of receiving, thereby the write cache transfer is stopped until the error is recovered. The data transfer rate is thus degraded significantly. Consequently, the data transfer rate, which is a transfer rate per unit of data, is lowered more and more as the time required until it is requested to transfer the next data gets longer. Otherwise, the data transfer rate, which is a transfer rate per write command, is lowered more and more as the time required between transmission of a write command and notification of the completion of the write command gets longer and longer.
Because an AV application program as described above transfers a series of mass data sequentially, it is often requested to guarantee the minimum value of the data transfer rate. In the conventional write cache transfer, however, if a write error occurs, the data transfer rate is degraded significantly, thereby it is difficult to meet such a request for assuring the minimum value of the data transfer rate.
As described above, therefore, the conventional write cache transfer has been confronted with a problem that the minimum value of the data transfer rate must be kept high.
It is an object of the present invention to provide a method for preventing such significant degradation of a data transfer rate, as well as maintaining the minimum data transfer rate at a higher rate.
In order to achieve the above object, the write cache transfer controlling method of the present invention comprises the steps of:
[A] setting an initial value Ti of a virtual buffer full capacity T to F/N (where F is a data capacity of the buffer, and N greater than 1);
[B] determining if an amount of write cached data S, which is increased by write cache transfer and decreased by writing the transferred data on the recording medium, reaches the virtual buffer full capacity T; and
[C] setting the transfer rate of a unit of data lower while the amount of write cached data S reaches the initial value Ti of the virtual buffer full capacity (Sxe2x89xa7Ti) than that while the amount of write cached data S does not reach the initial value Ti of the virtual buffer full capacity (S less than Ti)
More specifically, in the step of [C], the data transfer is enabled during an S less than T period. And, when the virtual buffer becomes full (S=T), the data transfer is inhibited until S less than T is satisfied. And, while the virtual buffer is full with data, the virtual buffer full capacity is reset to a larger value each time writing of the write cached data is stopped.
Further, more specifically, in the step of [C], while the amount of write cached data S does not reach the initial value Ti of the virtual buffer full capacity, a unit of data is transferred continuously. While the amount of write cached data S reaches the initial value Ti of the virtual buffer full capacity, a unit of data is transferred sequentially at certain time intervals.
Furthermore, the disk unit of the present invention comprises a write cache buffer for storing data transferred from outside; a write cache transfer controller for controlling write cache transfer for sequentially transferring a unit of data to the buffer from outside; a disk recording medium written with write cached data from the buffer; data write means for writing the write cached data cyclically in a plurality of sectors in a track on the surface of the disk recording medium; and a write controller for detecting a position of the data write means on the disk recording medium and positioning the data write device on a target track so as to write the cached data on the disk recording medium.
The write cache transfer controller is provided with means for setting an initial value Ti of a virtual buffer full capacity T to F/N (where F is a data capacity of the buffer, and N greater than 1); means for detecting an amount of write cached data S, which is increased by the write cache transfer and decreased by writing the transferred data on the disk recording medium, and determining if this amount of write cached data S reaches the virtual buffer full capacity T; and controlling means for delaying the transfer rate of the unit of data more while the amount of write cached data S reaches the initial value Ti of the virtual buffer full capacity (Sxe2x89xa7Ti) than that while the amount of write cached data S does not reach the initial value Ti of the virtual buffer full capacity (S less than Ti)
More specifically, the controlling means includes a device for enabling the data transfer during an S less than T period and inhibiting the data transfer until S less than T is satisfied if the virtual buffer becomes full (S=T), as well as means for resetting the virtual buffer full capacity T to a larger value each time writing of the cached data on a disk is stopped while the virtual buffer full is continued.
Further, more specifically, the write controlling means continues writing at the current disk rotation even when a write error occurs in a sector and retries the writing in the error-detected sector at the next disk rotation.
Further, more specifically, the controlling means transfers a unit of data sequentially and continuously while the amount of write cached data S does not reach the initial value Ti of the virtual buffer full capacity and transfers a unit of data sequentially at certain time intervals while the amount of write cached data S reaches the initial value Ti of the virtual buffer full capacity.